package com.ssi.mrms.model;

import java.util.LinkedHashMap;
import java.util.List;

public class JQueryDataTableParamModel<T> {

	public String sEcho;

	public String sSearch;

	public int iDisplayLength;

	public int iDisplayStart;

	public int iColumns;

	public int iSortingCols;

	public int iSortColumnIndex;

	public String sSortDirection;

	public String sColumns;

	public List<T> items;

	public LinkedHashMap<String, Object> toJSON(DataTableModel<T> dataTableModel) {
		LinkedHashMap<String, Object> jsonData = new LinkedHashMap<>();
		jsonData.put("iTotalRecords", dataTableModel.getTotal());
		jsonData.put("iTotalDisplayRecords", dataTableModel.getTotal());
		jsonData.put("aaData", dataTableModel.getItems());
		jsonData.put("sEcho", this.sEcho);
		return jsonData;
	}
}